package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.io.*;
import java.util.*;
import beans.BeanEnlaces;
import mapping.Enlace;

public final class insertaenlace_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\n');
      out.write('\n');
      out.write('\n');
      beans.BeanEnlaces mybean = null;
      synchronized (_jspx_page_context) {
        mybean = (beans.BeanEnlaces) _jspx_page_context.getAttribute("mybean", PageContext.PAGE_SCOPE);
        if (mybean == null){
          mybean = new beans.BeanEnlaces();
          _jspx_page_context.setAttribute("mybean", mybean, PageContext.PAGE_SCOPE);
        }
      }
      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n");
      out.write("\t<script src=\"ajax/ajax_enlaces.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("\t<script src=\"ajax/ajax_utils.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n");
      out.write("</head>\n");
      out.write("<body onload=\"ocultaOpcionesAdmin()\">\n");
      out.write("\t");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "cabecera_admin.jsp", out, false);
      out.write('\n');
      out.write('	');
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "menu_admin.html", out, false);
      out.write("\n");
      out.write("\t<div id=\"contenido\">\n");
      out.write("\t\t<h2 class=\"titform\">Datos de nuevo enlace</h2>\n");
      out.write("\t\t<hr class=\"hrmarron\" color=\"#cc6600\">\n");
      out.write("\t\t<br/>\n");
      out.write("\t\t<form id=\"form_insert_enlace\" onsubmit=\"return false;\">\n");
      out.write("\t\t<div style=\"float: left\">\n");
      out.write("\t\t\t<label for=\"nom_enlace\">Nombre:</label>\n");
      out.write("\t\t\t<input type = \"text\" name=\"nom_enlace\" id = \"nom_enlace\" size=\"35\" maxlength=\"50\">\n");
      out.write("\t\t</div>\n");
      out.write("\t\t<div>\n");
      out.write("\t\t\t<label for=\"tipo_enlace\">Tipo</label>\n");
      out.write("\t\t\t<select id = \"tipo_enlace\" name=\"tipo_enlace\">\n");
      out.write("\t\t\t");

				mybean.conectar();
				List listaTipoEnlaces = mybean.getTipoEnlaces();
				Iterator it = listaTipoEnlaces.iterator();
				while(it.hasNext()){
					String [] valorTipo = ((String) it.next()).split(",");
			
      out.write("\n");
      out.write("\t\t\t\t\t<option value = \"");
      out.print(valorTipo[0]);
      out.write('"');
      out.write('>');
      out.print(valorTipo[1]);
      out.write("</option>\n");
      out.write("\t\t\t");

				}//fin while
				mybean.desconectar();
			
      out.write("\n");
      out.write("\t\t\t</select>\n");
      out.write("\t\t</div>\n");
      out.write("\t\t\t\n");
      out.write("\t\t<br/><br/>\n");
      out.write("\t\t\n");
      out.write("\t\t<div id=\"capabotones\">\n");
      out.write("\t\t\t<button onclick=\"agregarOtroURLDescrip()\">Agregar otra URL</button>\n");
      out.write("\t\t\t<input name=\"numMaxURLS\" id=\"numMaxURLS\" type=\"text\" value=\"1\" size=\"2\">\n");
      out.write("\t\t\t<input name=\"numActualURLS\" id=\"numActualURLS\" type=\"text\" value=\"1\" size=\"2\">\n");
      out.write("\t\t\t<button id=\"btnBorrar\" onclick=\"eliminaFilas()\" disabled>Borra URL</button>\n");
      out.write("\t\t</div>\n");
      out.write("\t\t<br/>\n");
      out.write("\t\t<div id=\"tablaInsercion\">\n");
      out.write("\t\t\t<div class=\"divurl\" id=\"div_url1\">\n");
      out.write("\t\t\t\t<input type=\"hidden\" id=\"idurl1\" name=\"idurl1\" size=\"2\" value=\"0\">\n");
      out.write("\t\t\t\t<input type=\"checkbox\" class=\"chkbox\" id=\"chkbox_1\" name=\"chkbox_1\">\n");
      out.write("\t\t\t\t<input type=\"text\" id=\"url1\" name=\"url1\" size=\"45\" value=\"http://\" maxlength=\"100\">\n");
      out.write("\t\t\t\t<br/>\n");
      out.write("\t\t\t\t<textarea rows=\"3\" cols=\"37\" id=\"desc1\" name=\"desc1\"></textarea>\n");
      out.write("\t\t\t</div>\n");
      out.write("\t\t</div>\n");
      out.write("\t\t<br/>\n");
      out.write("\t\t<div id=\"capabotones\">\n");
      out.write("\t\t\t<button onclick=\"direccionar('index_admin.jsp')\">Cancelar</button>\n");
      out.write("\t\t\t<button id=\"btInsEnlace\" onclick=\"procesaParametros('res_insert', 'form_insert_enlace', 'proc_inserta_enlace.jsp', 'get');\n");
      out.write("\t\t\tdeshabilitar(this);agregaBarraCarga('res_insert')\">Guardar</button>\n");
      out.write("\t\t</div>\n");
      out.write("\t</form>\n");
      out.write("\t<div id=\"res_insert\"></div>\n");
      out.write("\t</div>\n");
      out.write("\t");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(request, response, "pie.html", out, false);
      out.write('\n');
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
